import React, { Fragment, useState } from "react";
import { View, Text } from "@tarojs/components";
import Taro from "@tarojs/taro";
import { AuthButton } from "@/components";

const AuthButtonScreen: Taro.FC = () => {
	const [text, setText] = useState('' as string)
	const onContactTa = (e) => {
		setText(e.detail.errMsg)
	}
	return (
		<Fragment>
			<View
				style={{
					display: "flex",
					justifyContent: "space-around",
					alignItems: "center"
				}}
			>
				<AuthButton
					openType='getUserInfo'
					style={{ background: "#f66", color: "#fff" }}
					className="fixed-btn fixed-btn_primary"
					onCallBack={(e) => onContactTa(e)}>
					<Text>授权登录</Text>
				</AuthButton>
				<AuthButton
					openType='getPhoneNumber'
					className="fixed-btn fixed-btn_primary"
					onCallBack={(e) => onContactTa(e)}>
					<Text>授权手机号</Text>
				</AuthButton>

			</View>
			<View style={{ marginTop: "10px", textAlign: "center" }}>
				{text}
			</View>
		</Fragment>
	);
};
export default AuthButtonScreen;
